#include <iostream>

int josephus_recursive(int n, int k) {
    if (n == 1) {
        return 1;
    } else {
        return (josephus_recursive(n - 1, k) + k - 1) % n + 1;
    }
}

int main() {
    int n = 10;
    int k = 5;
    std::cout << josephus_recursive(n, k) << std::endl;
    return 0;
}
